package com.jt.assistant.base

import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import com.tencent.mmkv.MMKV
import com.yzp.mvvmlibrary.app.App
import me.jessyan.retrofiturlmanager.RetrofitUrlManager


class BaseApplication : App() {
    companion object {
        private var application: BaseApplication? = null
        fun getContext(): BaseApplication {
            return application!!
        }

    }

    override fun onCreate() {
        super.onCreate()
        application = this
        //Logger的初始化
        val formatStrategy: FormatStrategy = PrettyFormatStrategy.newBuilder()
            .showThreadInfo(true) // 显示线程信息
            .methodCount(2) // 显示这一行的Log又几个方法的嵌套
            .methodOffset(0) // 隐藏内部方法调用，以抵消。默认的5
            .tag("=======》") // 每个日志的全局标记。默认PRETTY_LOGGER
            .build()
        Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))
        MMKV.initialize(this)
    }


}